<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>用户注册</title>
		<link rel="stylesheet" type="text/css" href="/style/home/css/login.css">
                <script src="/style/admin/js/jquery.js"></script> 
	</head>
	<body>
            <form  method="post"  id="RegForm" onsubmit="return false">
		<div class="regist">
			<div class="regist_center">
				<div class="regist_top">
					<div class="left fl">会员注册</div>
					<div class="right fr"><a href="./index.html" target="_self">小米商城</a></div>
					<div class="clear"></div>
					<div class="xian center"></div>
				</div>
				<div class="regist_main center">
                                    <div class="username">用&nbsp;&nbsp;户&nbsp;&nbsp;名:&nbsp;&nbsp;<input class="shurukuang" type="text" name="name" placeholder="请输入你的用户名"/><span id="UserError"></span></div>
                                    <div class="username">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:&nbsp;&nbsp;<input class="shurukuang" type="password" name="pass" placeholder="请输入你的密码"/><span id="PassError"></span></div>
					
                                        <div class="username">确认密码:&nbsp;&nbsp;<input class="shurukuang" type="password" name="repass" placeholder="请确认你的密码"/><span id="PassError"></span></div>
					<div class="username">手&nbsp;&nbsp;机&nbsp;&nbsp;号:&nbsp;&nbsp;<input class="shurukuang" type="text" name="tel" placeholder="请填写正确的手机号"/><span>填写下手机号吧，方便我们联系您！</span></div>
					<div class="username">
						<div class="left fl">验&nbsp;&nbsp;证&nbsp;&nbsp;码:&nbsp;&nbsp;<input class="yanzhengma" type="text" name="code" placeholder="请输入验证码"/></div>
						<div class="right fl"><img onclick="this.src='{{URL('/admin/login/1')}}?' + new Date().getTime();" src="{{URL('/admin/login/1')}}" id="captcha" /></div>
						<div class="clear"></div>
					</div>
				</div>
				<div class="regist_submit">
                                    <input class="submit" type="submit" onclick="add();" value="立即注册" >
				</div>
				
			</div>
		</div>
		</form>
	</body>
        <script>
              function add(){ 
                 str=$("#RegForm").serialize(); 
                 $.post('/home/regist',{str:str,'_token':'{{csrf_token()}}'},function(data){
                      if(data==1){
                          window.location.href="/home/login";
                      }else if(data.name){
                          $("#UserError").text(data.name);
                          $("#UserError").css("color","red");
                      }else if(data.pass){ 
                          $("#PassError").text(data.pass);
                          $("#UserError").css("color","red");
                      } 
                 });
              }
        </script>
</html>